#!/usr/local/env python
# coding=utf-8

#定义不同类型变量
a = 11
b = 923748659834751027591865396
c = "i am a string!"
d = ['i', 'am', 'a', 'list!']
e = ('i am a tuple!',)
f = {1: "i'm a dict", 2: '!', 3: ["i'm in dict"]}
def g():
    return "i'm a function"
h=open('server.log2016061614')
h.close()

#利用type函数，打印不同类型变量的类型是啥
for i in a,b,c,d,e,f,g,h:
    for name,value in locals().items():
        if value==i and name!='i':
            print "变量%s类型是:%s" % (name,type(i))

#当然你也没必要用循环打印出变量类型，直接print拼就行
print "---变量a类型是:",type(a)
print "---变量b类型是:",type(b)
print "---变量c类型是:",type(c)
print "---变量d类型是:",type(d)
print "---变量e类型是:",type(e)
print "---变量f类型是:",type(f)
print "---变量g类型是:",type(g)
print "---变量h类型是:",type(h)


